package org.huawei260.TiKu;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

import static java.lang.Character.isDigit;

public class Main {

	/**
	 * @Auther: qingle
	 * @Date: 2024/10/27-21:41
	 * @Description:
	 * @version: 1.0
	 */
//	public class B_2509_判断一组不等式是否满足约束并输出最大差 {

		//	public class InequalitySolver {
		public static void main(String[] args) {
			Scanner scanner = new Scanner(System.in);
			String[] inputs = scanner.nextLine().split(";");
			double[][] coefficients = new double[3][];
			int[] variables = new int[5];
			double[] targets = new double[3];
			String[] constraints = new String[3];

			for (int i = 0; i < 3; i++) {
				String[] line = inputs[i].split(",");
				coefficients[i] = new double[]{Double.parseDouble(line[0]), Double.parseDouble(line[1]), Double.parseDouble(line[2]), Double.parseDouble(line[3]), Double.parseDouble(line[4])};
			}

			String[] variablesInput = inputs[3].split(",");
			for (int i = 0; i < 5; i++) {
				variables[i] = Integer.parseInt(variablesInput[i]);
			}

			String[] targetsInput = inputs[4].split(",");
			for (int i = 0; i < 3; i++) {
				targets[i] = Double.parseDouble(targetsInput[i]);
			}

			constraints = inputs[5].split(",");

			boolean isValid = true;
			int maxDiff = 0;
			for (int i = 0; i < 3; i++) {
				double leftSide = 0;
				for (int j = 0; j < 5; j++) {
					leftSide += coefficients[i][j] * variables[j];
				}
				switch (constraints[i]) {
					case "<=":
						if (leftSide > targets[i]) {
							isValid = false;
						}
						break;
					case "<":
						if (leftSide >= targets[i]) {
							isValid = false;
						}
						break;
					case ">=":
						if (leftSide < targets[i]) {
							isValid = false;
						}
						break;
					case ">":
						if (leftSide <= targets[i]) {
							isValid = false;
						}
						break;
					case "=":
						if (leftSide != targets[i]) {
							isValid = false;
						}
						break;
				}
				if (isValid) {
					maxDiff = Math.max((int) Math.abs(leftSide - targets[i]), maxDiff);
				}
			}

			System.out.println(isValid ? "true " + maxDiff : "false 0");
		}
//	}
	}
